/**
 * 端口监听
 */

export default async (server) => {
    await new Promise((resolve) => { 
        const { koa, config = {} } = server;
        const hostname = config.server?.hostname || 'localhost';
        const port = config.server?.port || 80;
        koa.listen(port, hostname, () => {
            server.baseUrl = `http://${hostname}:${port}`;
            resolve()
        })
    })
}